export function vh2px(vh) {
    return toFixed(vh * (window.innerHeight / 100))
}

export function vw2px(vw) {
    return toFixed(vw * (window.innerWidth / 100))
}

export function px2Vh(px) {
    return toFixed(px / (window.innerHeight / 100))
}

export function px2Vw(px) {
    return toFixed(px / (window.innerWidth / 100))
}

// 保留n位小数
export function toFixed(num) {
    let fixed = num.toFixed(3);
    return parseFloat(fixed)
}